package text

import "github.com/mozillazg/go-pinyin"

func Pinyin(source string) string {
	arguments := pinyin.NewArgs()
	arguments.Separator = " "
	return pinyin.Slug(source, arguments)

	//source := "中国人"
	//
	//a := pinyin.NewArgs()
	//fmt.Println(pinyin.Pinyin(source, a)) // [[zhong] [guo] [ren]]
	//
	//a.Style = pinyin.Tone                 // 声调
	//fmt.Println(pinyin.Pinyin(source, a)) // [[zhōng] [guó] [rén]]
	//
	//a.Style = pinyin.Tone2                // 数字声调
	//fmt.Println(pinyin.Pinyin(source, a)) // [[zho1ng] [guo2] [re2n]]
	//
	//a = pinyin.NewArgs()
	//a.Heteronym = true                    // 多音字
	//fmt.Println(pinyin.Pinyin(source, a)) // [[zhong zhong] [guo] [ren]]
	//
	//a.Style = pinyin.Tone2
	//fmt.Println(pinyin.Pinyin(source, a)) // [[zho1ng zho4ng] [guo2] [re2n]]
	//
	//fmt.Println(pinyin.LazyPinyin(source, pinyin.NewArgs())) // [zhong guo ren]
	//fmt.Println(pinyin.Convert(source, nil))                 // [[zhong] [guo] [ren]]
	//fmt.Println(pinyin.LazyConvert(source, nil))             // [zhong guo ren]
}

// https://github.com/mozillazg/go-pinyin
// https://github.com/mozillazg/pinyin-data
// https://github.com/mozillazg/phrase-pinyin-data
// https://github.com/mozillazg/python-pinyin
// https://github.com/mozillazg/pypinyin-dict
